from django.db import models


class News(models.Model):
    id = models.CharField(max_length=36, primary_key=True)
    title = models.CharField(max_length=32)
    content = models.TextField()
    img = models.CharField(max_length=255)
    TYPE_CHOICES = [
        (0, '新闻'),
        (1, '活动'),
        (2, '公告'),
    ]
    type = models.IntegerField(choices=TYPE_CHOICES, null=True, blank=True)
    create_time = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.title

    class Meta:
        db_table = 'news'
